package day0220;

public class Demo05 {

    public static void main(String[] args) {
        new SubClass();
    }
}

class SupClass {

    int x = 10;
    static int y = 20;

    {
        x = 11;
        System.out.println("SupClass {}");
    }

    static{
        y = 21;
        System.out.println("SupClass static{}");
    }

    public SupClass() {
        System.out.println("SupClass()");
        print();
    }

    public void print() {
        System.out.println("supClass.print()");
        System.out.println("x = " + x);
        System.out.println("y = " + y);
    }
}

class SubClass extends SupClass{
    int x = 30;
    static int y = 40;

    {
//        x = 31;
        System.out.println("SubClass {}");
    }


    static{
        y = 41;
        System.out.println("SubClass static{}");
    }

    public SubClass() {
        System.out.println("SubClass()");
        print();
    }

    @Override
    public void print() {
        System.out.println("subClass.print()");
        System.out.println("x = " + x);
        System.out.println("y = " + y);
    }
}
